<?php
/*
  $Id: specials.php,v 1.31 2003/06/09 22:21:03 hpdl Exp $

  E-Commerce Solutions

  Copyright (c) 2005 www.flash-template-design.com

  Released under the GNU General Public License
*/

  if ($random_product = tep_random_select("select p.products_id, pd.products_name, p.products_price, p.products_tax_class_id, p.products_image, s.specials_new_products_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_SPECIALS . " s where p.products_status = '1' and p.products_id = s.products_id and pd.products_id = s.products_id and pd.language_id = '" . (int)$languages_id . "' and s.status = '1' order by s.specials_date_added desc limit " . MAX_RANDOM_SELECT_SPECIALS)) {
?>
<!-- specials //-->
             <tr>
            <td valign="top" style="padding-top:3px; padding-left:1px; ">
<?php
    $info_box_contents = array();
    $info_box_contents[] = array('text' => '<table border="0" width="100%" cellpadding="0" cellspacing="0">
												<tr>
													<td height="16" bgcolor="#D5C592"><p style="color:#FFFFFF; padding-left:5px; font-weight:bold; font-family:Tahoma, Helvetica, sans-serif; font-size:14px;">'.BOX_HEADING_SPECIALS.'</p></td>
												</tr>
												<tr>
				            						<td colspan="2">'.tep_draw_separator('pixel_trans.gif', '100%', '2').'</td>
						          				</tr>	
											 </table>');
?>
<div style="padding-top:1px;">
<?php
    new infoBoxHeading($info_box_contents, false, false, tep_href_link(FILENAME_SPECIALS));
?></div>
<?php
$sql = 'SELECT `products_description` FROM `products_description` WHERE products_id ='.$random_product['products_id'].' && language_id='.(int)$languages_id;
	$description_query = tep_db_query($sql);
	$description = mysql_fetch_array($description_query, MYSQL_ASSOC);        
	$description['products_description'] = substr($description['products_description'], 0, 65);
	$desc_len = strlen($description['products_description']);
	$description['products_description'][$desc_len-1] = '.';
	$description['products_description'][$desc_len-2] = '.';
	$description['products_description'][$desc_len-3] = '.';
    $info_box_contents = array();
    $info_box_contents = array();
    $info_box_contents[] = array('align' => 'center',
                                 'text' => '<table border="0" width="100%" cellpadding="0" cellspacing="0" style="border:1px solid #D7CEB2;">
								 				<tr>
													<td colspan="2" style="padding-top:5px; padding-left:5px;"><a class="block_goods_nm" href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $random_product['products_id']) . '">' . $random_product['products_name'] . '</a></td>
												</tr>
												<tr>
													<td colspan="2"><div style="color:#A89969;padding-left:5px;">'.$description['products_description'].'</div></td>
												</tr>
												<tr>
													<td width="79" height="100" align="center" style="padding-bottom:3px; padding-top:3px;"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $random_product['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $random_product['products_image'], $random_product['products_name']) . '</a></td>
													<td valign="bottom" style="padding-bottom:9px;"><div style="color:#BB0202; font-size:17px;padding-bottom:4px; "><span class="productOldPrice">' . $currencies->display_price($random_product['products_price'], tep_get_tax_rate($random_product['products_tax_class_id'])) . '</span><br /><span class="productSpecialPrice">' . $currencies->display_price($random_product['specials_new_products_price'], tep_get_tax_rate($random_product['products_tax_class_id'])) . '</span></div></td>
												</tr>	
												</table>
												<table border="0" width="100%" cellpadding="0" cellspacing="0" style="margin-top:2px;">
													<tr>
													<td width="50%" >'.tep_draw_form('cart_quantity', tep_href_link(FILENAME_PRODUCT_INFO, tep_get_all_get_params(array('action')) . 'action=add_product')).
													'<a href="'.tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $random_product['products_id']).'">'.tep_image_button('button_details.gif', IMAGE_BUTTON_DETAILS).'</a></td><td align="right">'.
													tep_draw_hidden_field('products_id', $random_product['products_id']) . tep_image_submit('button_buy_now.gif', IMAGE_BUTTON_BUY_NOW).'</form></td></tr>
												</table>');






    new infoBox($info_box_contents);
	//new infoBoxFooter();
?>
            </td>
          </tr>
<!-- specials_eof //-->
<?php
  }
?>
